package com.yuezhi.consumer.Listener;

import com.yuezhi.consumer.constant.QueueConstant;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

/**
 * 发布订阅模式下
 * 消费者（Direct 交换机）
 */
@Component
public class DirectReceiver {

    @RabbitListener(queues = QueueConstant.DIRECT_QUEUE)
    public void handler(Message<String> message) {
        System.out.println("DirectReceiver：[" + message.getPayload() + "]");
    }
}
